package com.htpay.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

/**
 * 商户收支明细
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class MerchantIncomeInfo implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 商户ID
     */
    private Integer merchantId;

    /**
     * 100 财付通 101支付宝 102网银 103聚合支付
     * 207微信 208微信H5 209支付宝H5
     */
    private String chargeType;

    /**
     * 用户单笔充值金额
     */
    private String money;

    /**
     * 条数
     */
    private Integer count;

    public void setMoney(BigDecimal money) {
        this.money = money.setScale(2, RoundingMode.HALF_UP).toString();
    }

    public void setRoyaltyRatio(BigDecimal royaltyRatio) {
        this.royaltyRatio = royaltyRatio.setScale(2, RoundingMode.HALF_UP).toString();
    }

    /**
     * 提成比例
     */
    private String royaltyRatio;

    /**
     * 创建人
     */
    private String createBy;

    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新人
     */
    private String updateBy;

    /**
     * 更新时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

}
